/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package principalcontrole;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import javax.swing.table.DefaultTableModel;
import utilitario.Arquivo;
import utilitario.Cliente;
import utilitario.cad_produto;
import utilitario.lucro;
//add aqui
/**
 *
 * @author rodrig0
 */

public class relatorio extends javax.swing.JFrame {
public ArrayList<Cliente> lista_de_clientes = new ArrayList<>();
public ArrayList<lucro> listaLucro = new ArrayList<>();
public ArrayList<top_clientes> lista_top_clientes = new ArrayList<>();
public ArrayList<top_clientes> lista_top_clientesOrdenada = new ArrayList<>();
public ArrayList<cad_produto> lista_de_produtos = new ArrayList<>();
int quantidades[];
String nomes[];
principal a;
    /**
     * Creates new form relatorio
     */

    public relatorio(principal a){
           this();
           this.a = a;


    }
    public relatorio() {
        initComponents();
        lucro_texto.setText("Lojas AIAM\n" +
                                               "Lucro Real do período VARIAVELDATA1 a VARIAVELDATA2\n"+
                                                 "---------------------------------------------------------------------------------------------\n"+
                                                "R$ ");
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jTabbedPane1 = new javax.swing.JTabbedPane();
        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        top_datade = new com.toedter.calendar.JDateChooser();
        jLabel4 = new javax.swing.JLabel();
        btn_top10 = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        top_dataa = new com.toedter.calendar.JDateChooser();
        jPanel3 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        prodDE = new com.toedter.calendar.JDateChooser();
        jLabel6 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jScrollPane3 = new javax.swing.JScrollPane();
        tabela_produtos_vendidos = new javax.swing.JTable();
        prodA = new com.toedter.calendar.JDateChooser();
        jPanel1 = new javax.swing.JPanel();
        lucrode = new com.toedter.calendar.JDateChooser();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        lucro_texto = new javax.swing.JTextArea();
        lucroW = new com.toedter.calendar.JDateChooser();
        jPanel4 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
            public void windowClosed(java.awt.event.WindowEvent evt) {
                formWindowClosed(evt);
            }
            public void windowOpened(java.awt.event.WindowEvent evt) {
                formWindowOpened(evt);
            }
        });

        jLabel3.setText("a.:");

        top_datade.setDateFormatString("dd/mm/yyyy");

        jLabel4.setText("De.:");

        btn_top10.setText("Gerar Top 10 Clientes");
        btn_top10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_top10ActionPerformed(evt);
            }
        });

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Nome do Cliente", "CPF", "Quantidade Comprada"
            }
        ));
        jTable1.setEnabled(false);
        jScrollPane2.setViewportView(jTable1);

        top_dataa.setDateFormatString("dd/mm/yyyy");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(244, 244, 244)
                .addComponent(jLabel4)
                .addGap(18, 18, 18)
                .addComponent(top_datade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(26, 26, 26)
                .addComponent(jLabel3)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(top_dataa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(19, 19, 19)
                .addComponent(btn_top10)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(58, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 779, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(77, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGap(46, 46, 46)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(btn_top10)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4)
                    .addComponent(top_datade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(top_dataa, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 44, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jTabbedPane1.addTab("Top Clientes", jPanel2);

        jLabel5.setText("a.:");

        prodDE.setDateFormatString("dd/mm/yyyy");

        jLabel6.setText("De.:");

        jButton2.setText("Produto mais vendidos");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        tabela_produtos_vendidos.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {

            },
            new String [] {
                "Produto", "Quantidade Vendida"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jScrollPane3.setViewportView(tabela_produtos_vendidos);

        prodA.setDateFormatString("dd/MM/YYYY");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(111, 111, 111)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 628, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(jLabel6)
                        .addGap(18, 18, 18)
                        .addComponent(prodDE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(26, 26, 26)
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(prodA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(69, 69, 69)
                        .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 202, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(175, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGap(84, 84, 84)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jButton2)
                    .addComponent(jLabel5)
                    .addComponent(jLabel6)
                    .addComponent(prodDE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(prodA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(58, 58, 58)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 281, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(105, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Produtos Mais vendidos", jPanel3);

        lucrode.setDateFormatString("dd/mm/yyyy");

        jLabel1.setText("De.:");

        jLabel2.setText("a.:");

        jButton1.setText("Gerar Relatorio");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        lucro_texto.setColumns(20);
        lucro_texto.setRows(5);
        jScrollPane1.setViewportView(lucro_texto);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(173, 173, 173)
                        .addComponent(jLabel1)
                        .addGap(18, 18, 18)
                        .addComponent(lucrode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(26, 26, 26)
                        .addComponent(jLabel2)
                        .addGap(66, 66, 66)
                        .addComponent(lucroW, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(32, 32, 32)
                        .addComponent(jButton1))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(58, 58, 58)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 805, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(51, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(80, 80, 80)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButton1)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jLabel2)
                        .addComponent(jLabel1)
                        .addComponent(lucrode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addComponent(lucroW, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(41, 41, 41)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(230, Short.MAX_VALUE))
        );

        jTabbedPane1.addTab("Lucro Real", jPanel1);

        jPanel4.setBackground(new java.awt.Color(204, 0, 204));
        jPanel4.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 0, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 69, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jTabbedPane1)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jTabbedPane1))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        Calendar w = lucroW.getCalendar();
        lucroTotal(lucrode.getCalendar(), lucroW.getCalendar());
        lucro_texto.append(lucroTotal(lucrode.getCalendar(), lucroW.getCalendar())+"");
    }//GEN-LAST:event_jButton1ActionPerformed

        public double lucroTotal(Calendar dataIni, Calendar dataFim){
       double lucroTotal = 0;
       for (int i = 0; i < listaLucro.size(); i++) {
           String dataInicial = dataIni.get(Calendar.DAY_OF_MONTH) + "/" + dataIni.get(Calendar.MONTH) + "/" + dataIni.get(Calendar.YEAR);
           String dataFinal = dataFim.get(Calendar.DAY_OF_MONTH) + "/" + dataFim.get(Calendar.MONTH) + "/" + dataFim.get(Calendar.YEAR);
           String dataLucro = listaLucro.get(i).getData().get(Calendar.DAY_OF_MONTH) + "/" + listaLucro.get(i).getData().get(Calendar.MONTH) + "/" + listaLucro.get(i).getData().get(Calendar.YEAR);
           if(dataLucro.compareTo(dataInicial) >= 0 && dataLucro.compareTo(dataFinal) <= 0){
                lucroTotal += listaLucro.get(i).getLucro();
            }
        }
       return lucroTotal;
   }

    private void btn_top10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_top10ActionPerformed
        lista_de_clientes = Arquivo.lerCliente();
        Calendar dataini = top_datade.getCalendar();
        Calendar datafim = top_dataa.getCalendar();
        top_clientes top = new top_clientes();

        String data_ini = dataini.get(Calendar.DAY_OF_MONTH)+"/"+dataini.get(Calendar.MONTH)+"/"+dataini.get(Calendar.YEAR);
        String data_fim = datafim.get(Calendar.DAY_OF_MONTH)+"/"+datafim.get(Calendar.MONTH)+"/"+datafim.get(Calendar.YEAR);
        for (int i = 0; i<lista_de_clientes.size(); i++){
            for (int j = 0; j<lista_de_clientes.get(i).getListaCompras().size(); j++){
            String data = lista_de_clientes.get(i).getListaCompras().get(j).getData_de_compra().get(Calendar.DAY_OF_MONTH)+"/"+
                    lista_de_clientes.get(i).getListaCompras().get(j).getData_de_compra().get(Calendar.MONTH)+"/"+
                    lista_de_clientes.get(i).getListaCompras().get(j).getData_de_compra().get(Calendar.YEAR);
                if(data.compareTo(data_ini)>=0 && data.compareTo(data_fim)<=0){
                    top.setNome(lista_de_clientes.get(i).getNome());
                   top.setValor(top.getValor()+lista_de_clientes.get(i).getListaCompras().get(j).getValor_total());
                   top.setCpf(lista_de_clientes.get(i).getCpf());
                }
            }
            lista_top_clientes.add(top);
            top = new top_clientes();
        }
preenchetabela();
    }//GEN-LAST:event_btn_top10ActionPerformed
void pegar(Calendar dataIni, Calendar dataFim){
       quantidades = new int[lista_de_produtos.size()];
       nomes = new String[lista_de_produtos.size()];
        for (int i = 0; i < lista_de_produtos.size(); i++) {
            quantidades[i] = 0;
            nomes[i] = lista_de_produtos.get(i).getNome();
            for (int j = 0; j < lista_de_produtos.get(i).getVendas().size(); j++) {
           String dataInicial = dataIni.get(Calendar.DAY_OF_MONTH) + "/" + dataIni.get(Calendar.MONTH) + "/" + dataIni.get(Calendar.YEAR);
           String dataFinal = dataFim.get(Calendar.DAY_OF_MONTH) + "/" + dataFim.get(Calendar.MONTH) + "/" + dataFim.get(Calendar.YEAR);
           String dataLucro = lista_de_produtos.get(i).getVendas().get(j).getData().get(Calendar.DAY_OF_MONTH) + "/" + lista_de_produtos.get(i).getVendas().get(j).getData().get(Calendar.MONTH) + "/" + lista_de_produtos.get(i).getVendas().get(j).getData().get(Calendar.YEAR);
           if(dataLucro.compareTo(dataInicial) >= 0 && dataLucro.compareTo(dataFinal) <= 0){
                quantidades[i] = quantidades[i] + lista_de_produtos.get(i).getVendas().get(j).getQuantidade_vendidos();
            }
        }
        }
        }


void ordenar(){
        for (int i = 0; i < quantidades.length; i++) {
            for (int j = 0; j < quantidades.length-1; j++) {
                if(quantidades[j] < quantidades[j+1]){
                    int auxq;
                    String auxs = "";
                    auxq = quantidades[j];
                    quantidades[j] = quantidades[j+1];
                    quantidades[j+1] = auxq;
                    auxs = nomes[j];
                    nomes[j] = nomes[j+1];
                    nomes[j+1] = auxs;
                }
            }
        }
}
public void preenchetabela(){
    Collections.sort(lista_top_clientes);
    Collections.reverse(lista_top_clientes);
       for (int i=0; i<lista_top_clientes.size(); i++){
       jTable1.getModel().setValueAt(lista_top_clientes.get(i).getNome(), i, 0);
       jTable1.getModel().setValueAt(lista_top_clientes.get(i).getCpf(), i, 1);
       jTable1.getModel().setValueAt(lista_top_clientes.get(i).getValor(), i, 2);
       }
}

    public class top_clientes implements Comparable<top_clientes>{
        String nome, cpf, situacao;
        double valor;

        public String getSituacao() {
            return situacao;
        }

        public void setSituacao(String situacao) {
            this.situacao = situacao;
        }

        public String getNome() {
            return nome;
        }

        public void setNome(String nome) {
            this.nome = nome;
        }

        public String getCpf() {
            return cpf;
        }

        public void setCpf(String cpf) {
            this.cpf = cpf;
        }

        public double getValor() {
            return valor;
        }

        public void setValor(double valor) {
            this.valor = valor;
        }

        @Override
        public int compareTo(top_clientes o) {
                        if(this.valor < o.valor){
                return -1;
            }
            if(this.valor > o.valor){
                return 1;
            }
            return 0;
        }
    }
    private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
        // TODO add your handling code here:
        listaLucro = Arquivo.lerLucro();
         lista_de_produtos = Arquivo.lerProduto();

    }//GEN-LAST:event_formWindowOpened

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        // TODO add your handling code here:
        DefaultTableModel dtm = (DefaultTableModel) tabela_produtos_vendidos.getModel();
        pegar(prodDE.getCalendar(),prodA.getCalendar());
        ordenar();

        Object campos[] = {null, null};


        for(int i = 0 ; i < quantidades.length; i++){
           dtm.addRow(campos);
           dtm.setValueAt(nomes[i], i, 0);
           dtm.setValueAt(quantidades[i], i, 1);
        }

    }//GEN-LAST:event_jButton2ActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        // TODO add your handling code here:
    }//GEN-LAST:event_formWindowClosing

    private void formWindowClosed(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosed
        // TODO add your handling code here:
        a.setEnabled(true);
        Thread t = new Thread();
        t.start();
    }//GEN-LAST:event_formWindowClosed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(relatorio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(relatorio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(relatorio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(relatorio.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new relatorio().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_top10;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JTabbedPane jTabbedPane1;
    private javax.swing.JTable jTable1;
    private com.toedter.calendar.JDateChooser lucroW;
    private javax.swing.JTextArea lucro_texto;
    private com.toedter.calendar.JDateChooser lucrode;
    private com.toedter.calendar.JDateChooser prodA;
    private com.toedter.calendar.JDateChooser prodDE;
    private javax.swing.JTable tabela_produtos_vendidos;
    private com.toedter.calendar.JDateChooser top_dataa;
    private com.toedter.calendar.JDateChooser top_datade;
    // End of variables declaration//GEN-END:variables
}
